package com.testing.end_bunner;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

import com.youth.banner.Banner;
import com.youth.banner.BannerConfig;
import com.youth.banner.Transformer;

import java.util.ArrayList;
import java.util.Arrays;

public class MainActivity extends AppCompatActivity {

    //https://github.com/youth5201314/banner

    ArrayList<String> images = new ArrayList<>();

    String[] titles;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        images.add("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1489118396&di=0bb68aecab17f556b147a4bb002787d3&imgtype=jpg&er=1&src=http%3A%2F%2Fpic36.nipic.com%2F20131130%2F4499633_224250411000_2.jpg");
        images.add("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1489118443&di=d2b89b3419cee83485ff75ebdfecbca1&imgtype=jpg&er=1&src=http%3A%2F%2Fpic.58pic.com%2F58pic%2F11%2F39%2F22%2F38c58PICtuS.jpg");
        images.add("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1489123995&di=be98279b03e8ec891831b3e633d75218&imgtype=jpg&er=1&src=http%3A%2F%2Fpic.58pic.com%2F58pic%2F13%2F01%2F43%2F84z58PIC6Yd.jpg");
        images.add("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1489124023&di=8646cd7d4629d745892d5e140f5e5fba&imgtype=jpg&er=1&src=http%3A%2F%2Fpic.58pic.com%2F58pic%2F13%2F01%2F20%2F60u58PICgTY.jpg");


        titles = new String[]{"A", "B", "C", "D"};
        ;


        Banner banner = (Banner) findViewById(R.id.banner);

        //设置banner样式
        banner.setBannerStyle(BannerConfig.CIRCLE_INDICATOR_TITLE_INSIDE);


        //设置图片加载器
        banner.setImageLoader(new GlideImageLoader());
        //设置图片集合
        banner.setImages(images);


        //设置banner动画效果
        banner.setBannerAnimation(Transformer.CubeOut);

        //设置标题集合（当banner样式有显示title时）
        banner.setBannerTitles(Arrays.asList(titles));//???


        //设置自动轮播，默认为true
        banner.isAutoPlay(true);


        //设置轮播时间
        banner.setDelayTime(1500);


        //设置指示器位置（当banner模式中有指示器时）
        banner.setIndicatorGravity(BannerConfig.RIGHT);


        //banner设置方法全部调用完毕时最后调用
        banner.start();
    }
}
